package algorithm;

/**
 * 70. 爬楼梯
 */
public class T00070 {
    public static void main(String[] args) {
        System.out.println(new Solution().climbStairs(10));
    }

static class Solution {
    public int climbStairs(int n) {
        if(n <= 1)
            return 1;
        if(n == 2)
            return n;
        int pp = 1;
        int p = 2;
        int r;
        while (n -- > 2) {
            r = pp + p;
            pp = p;
            p = r;
        }
        return p;
    }
}
}